package mianshitest;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

public class TEST1 {
    @Test
    public void f1(){
        StringBuilder stringBuilder = new StringBuilder("haha");
        change(stringBuilder);
        System.out.println(stringBuilder.toString());
    }

    @Test
    public void test2(){
        Map<String,Integer> map = new HashMap();
        map.put("num1",1);
        map.put("num2",2);
        map.put("num3",3);

        for(Map.Entry entry : map.entrySet()){

        }

        HashMap<String,Integer> map2 = new HashMap();
        map2.put("num1",1);
        map2.put("num2",2);
        map2.put("num3",3);

//        map2.forEach();

//        map2.forEach((k,v)->{
//            System.out.println("key:"+k);
//            System.out.println("value:"+v);
//        });
    }

    @Test
    public void test3(){
        Vector<String> stringVector = new Vector<>();
        stringVector.add("11111");
        stringVector.add("11112");
        stringVector.add("11113");
        stringVector.add("11114");
        stringVector.forEach(System.out::println);
    }

    @Test
    public void test4(){
        ShiTiClass shiTiClass = new AbstractFruit() {
            @Override
            public void f2() {
                super.f2();
                System.out.println("abstract -- f2()");
            }
        };
        shiTiClass.f1();
        shiTiClass.f2();
    }

    @Test public void test5(){
        String s = "123";
        byte b = 92;
        short st = 12;
        char c = 'd';
        boolean bn = true;
        long l = 122222;

        switch (st){
//            case "123":
//                System.out.println("case 1");
//                break;
//            case "456":
//                System.out.println("case 2");
//                break;
//            case 'bn':
//                System.out.println("case 3");
//                break;
//            case 'e':
//                System.out.println("case 4");
//                break;
            case 1:
                System.out.println("case 3");
                break;
            case 0:
                System.out.println("case 4");
                break;
        }
    }

    @Test
    public void test6(){
        int r = f2();
        System.out.println(r);
    }

    public int f2(){
        int i1 = Integer.MAX_VALUE;
        int i2 = -Integer.MAX_VALUE;
        System.out.println(i1);
        System.out.println(i2);
        return i1-i2;
    }

    void change(StringBuilder stringBuilder){
        stringBuilder.append("!!!");
    }


}
